<div class="main_item_box search_item head_position">
    <!-- <a class="logo1" href="/">
        <img src="<?php if(!empty($logo)) : ?><?php echo '/images/'.$logo.'.png' ?><?php else : ?>/statics/images/logo1.png<?php endif; ?>">
    </a> -->
    <a class="logo2" href="/">
        <img src="<?php if(!empty($logo_2)) : ?><?php echo '/images/'.$logo_2.'.png' ?><?php else : ?>/statics/images/logo2.png<?php endif; ?>">
    </a>
    <div class="user_car_hint">
        <a class="car_icon"><img src="/statics/images/car.png"></a>
        <a class="infor_status my_car" href="/cart/list">我的购物车</a>
        <span><?php echo $cart_count; ?></span>
    </div>
    <div class="search_goods">
        <form action="/goods/list">
            <input id="search_key_input"  autocomplete="off" type="text" name="keyword" placeholder="<?php if(!empty($keyword)) echo $keyword;?> <?php if(empty($keyword)) echo Config::model()->get('search_placeholder') ?>" value="" >
            <input type="submit" value="搜索">
            <div class='search_log'>
                <ul>
                </ul>
            </div>
        </form>
        <div class="hot_goods">
            <?php if(!empty($hot_search['data'])): ?>
                <?php foreach ($hot_search['data'] as $key => $value) :?>
                    <a href="/goods/list?keyword=<?php echo $value['title'] ?>"><?php echo $value['title'] ?></a>
                <?php endforeach; ?>
            <?php endif; ?>
        </div>
    </div>
    <div class="regis" style="display: none">
        <div class="regis_detail">
            <span class="regis_describe"><i><img src="/statics/images/regis_icon.png"></i>连续签到30天送福豆100</span>
            <a href="javascript:;" class="regis_now regis_not"><span>立即签到</span></a>
        </div>    
    </div>
</div>
<style type="text/css">
    .search_log{
        position: absolute;
        background-color: #fff;
        border: 1px solid #ccc;
        z-index: 9999;
        border-top:0;
        width: 494px;
    }
    .search_log li{
        line-height: 30px;
        text-indent: 10px;
        font-size: 12px;
    }
    .search_log li:hover{
        background-color: #F7F7F7; 
        cursor: pointer;
    }
</style>
<script type="text/javascript">
    $(function(){
        $('#search_key_input').keyup(function(){
            var key = $(this).val();
            if (key!=='') {
                $('.search_log ul').empty();
                $.ajax({
                    type:"Post",
                    dataType: "json",
                    url: "<?php echo $this->getController()->createUrl('/searchlog/find')?>",
                    data:{'key':key},
                    success: function(json){
                        if (json != '') {
                           $(json).each(function(i){
                                $('.search_log ul ').append("<li>"+json[i]['title']+"</li>");
                           })
                        }
                    },
                    error:function(e){

                    }
                });//ajax end
            }
            
        });
        $('.search_log').on('click','li',function(){
            var key = $(this).text();
            $('#search_key_input').val(key);
            $('.search_log ul').empty();
        });
    });
</script>